#ifndef UmlDirItem_H
#define UmlDirItem_H

#include <QList>
#include <QGraphicsScene>
#include <QStyleOptionGraphicsItem>
#include <QPainter>
#include <QDebug>

#include "uml/umlgraphicsitem.h"
#include "gui/editors/packageeditor.h"

#define PACKAGE_BORDER_COLOR "#A85D00"
#define PACKAGE_BG_COLOR "#E89A00"


class UmlDirItem : public UmlGraphicsItem
{
    Q_OBJECT

public:
    UmlDirItem(UmlProject *project = 0);
    ~UmlDirItem();

    virtual UmlDatatype umlDataType();

    void setText(QString name);

    void appendChild(UmlGraphicsItem *item);
    void removeChild(UmlGraphicsItem *item);
    QList<UmlGraphicsItem*> items();
    UmlGraphicsItem *child(int row);
    int childCount() const;

    void updateBoundingBox();
    QPainterPath shape() const;

    QVariant itemChange(GraphicsItemChange change, const QVariant &value);

    void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);

    QList<QAction*> contextActions();

protected:
    QList<UmlGraphicsItem*> _childItems;

    QPen _pen;
    QPainterPath _shape;

    QGraphicsTextItem _textItem;

    void openEditor();

protected slots:
    void openPackage();

};

#endif // UmlDirItem_H
